IF LASTKEY()=27
   CLOS ALL
   RETURN
ENDIF
recn2=RECN2+1
DO SAYG WITH 14,70,RECN2,'9,999.99','999,999'
*@ 14,70 say recn2 pict "999,999"
TPH=TPH+PHAR_SALE
PTL=PTL+PHAR_PAY
PPH=PPH+PHAR_PAY
HTL=HTL+PHAR_HL
HPH=HPH+PHAR_HL
MTL=MTL+PHAR_MS
MPH=MPH+PHAR_MS
NTL=NTL+1
NPH=NPH+1
do case
   case SUBSTR(PHAR_CODE,2,1)='0' .OR. SUBSTR(PHAR_CODE,2,1)='1'
      TDR=TDR+PHAR_SALE
      PDR=PDR+PHAR_PAY
      HDR=HDR+PHAR_HL
      MDR=MDR+PHAR_MS
      NDR=NDR+1
   case SUBSTR(PHAR_CODE,2,1)='5' .OR. SUBSTR(PHAR_CODE,2,1)='8'
      TIN=TIN+PHAR_SALE
      PIN=PIN+PHAR_PAY
      HIN=HIN+PHAR_HL
      MIN=MIN+PHAR_MS
      NIN=NIN+1
   case SUBSTR(PHAR_CODE,2,1)='4'
      TVA=TVA+PHAR_SALE
      PVA=PVA+PHAR_PAY
      HVA=HVA+PHAR_HL
      MVA=MVA+PHAR_MS
      NVA=NVA+1
   OTHERWISE
      TDI=TDI+PHAR_SALE
      PDI=PDI+PHAR_PAY
      HDI=HDI+PHAR_HL
      MDI=MDI+PHAR_MS
      NDI=NDI+1
ENDCASE
SKIP
